package com.luotat.employeeservice.mapper;

import com.luotat.pojo.employee.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface EmployeeMapper
{
    @Insert("INSERT INTO employee (name, gender, password) " +
            "VALUES (#{name}, #{gender}, #{password})")
    void insert(Employee employee);

    @Delete("DELETE FROM employee " +
            "WHERE id = #{id}")
    void delete(Integer id);

    @Update("UPDATE employee " +
            "SET name = #{name}, gender = #{gender}, password = #{password} " +
            "WHERE id = #{id}")
    void update(Employee employee);

    @Select("SELECT * " +
            "FROM employee " +
            "WHERE id = #{id}")
    Employee getById(Integer id);

    @Select("SELECT * " +
            "FROM employee")
    List<Employee> getAll();
}
